DZone
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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Trending

  • How to Load Cypress Chrome Extension
  • AI Technology Is Drastically Disrupting the Background Screening Industry
  • WireMock: The Ridiculously Easy Way (For Spring Microservices)
  • Using DuckDB With CockroachDB
  1. DZone
  2. Coding
  3. Languages
  4. 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 · Code Snippet
Like (2)
Save
Tweet
Share
3.89K 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.

Trending

  • How to Load Cypress Chrome Extension
  • AI Technology Is Drastically Disrupting the Background Screening Industry
  • WireMock: The Ridiculously Easy Way (For Spring Microservices)
  • Using DuckDB With CockroachDB

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • 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

Let's be friends: