DZone
Big Data Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Big Data Zone > Psychoacoustic Roughness

Psychoacoustic Roughness

Sometimes audio signals are rough problems to analyze. Who knew that it was a parameter of acoustic roughness? Well there is and it's called the asper.

John Cook user avatar by
John Cook
·
Jul. 23, 16 · Big Data Zone · Code Snippet
Like (2)
Save
Tweet
3.62K Views

Join the DZone community and get the full member experience.

Join For Free

acoustic roughness is measured in aspers. an asper is the roughness of a 1 khz tone, at 60 db, 100% modulated at 70 hz. that is, the signal

(1 + sin(140π t )) sin(2000π t )

where t is time in seconds.

1000 hz carrier fully modulated at 70 hz

here’s what that sounds like (if you play this at 60 db, about the loudness of a typical conversation at one meter):

http://www.johndcook.com/one_asper.wav

and here’s the python code that made the file:

from scipy.io.wavfile import write
from numpy import arange, pi, sin, int16

def f(t, f_c, f_m):
    # t    = time
    # f_c  = carrier frequency
    # f_m  = modulation frequency
    return (1 + sin(2*pi*f_m*t))*sin(2*f_c*pi*t)

def to_integer(signal):
    # take samples in [-1, 1] and scale to 16-bit integers,
    # values between -2^15 and 2^15 - 1.
    return int16(signal*(2**15 - 1))

n = 48000 # samples per second
x = arange(3*n) # three seconds of audio

# 1 asper corresponds to a 1 khz tone, 100% modulated at 70 hz, at 60 db
data = f(x/n, 1000, 70)
write("one_asper.wav", n, to_integer(data))
Python (language) Signal Conversations (software)

Published at DZone with permission of John Cook. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Package and Deploy a Lambda Function as a Docker Container With AWS CDK
  • Everything I Needed to Know About Observability, I Learned from ‘Bewitched’
  • A Simple Guide to Heaps, Stacks, References, and Values in JavaScript
  • Exporting and Importing Projects in Eclipse

Comments

Big Data Partner Resources

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo