Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2762 > unrolled thread

Re: How to generate sound of given frequency?

Started byryanbrummet09@augustana.edu
First post2013-09-03 13:12 -0700
Last post2013-10-21 20:36 -0700
Articles 7 — 4 participants

Back to article view | Back to comp.lang.java.help

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to generate sound of given frequency? ryanbrummet09@augustana.edu - 2013-09-03 13:12 -0700
    Re: How to generate sound of given frequency? "John B. Matthews" <nospam@nospam.invalid> - 2013-09-03 22:01 -0400
    Re: How to generate sound of given frequency? Knute Johnson <nospam@knutejohnson.com> - 2013-09-03 21:38 -0700
    Re: How to generate sound of given frequency? Roedy Green <see_website@mindprod.com.invalid> - 2013-09-09 01:46 -0700
      Re: How to generate sound of given frequency? Knute Johnson <nospam@knutejohnson.com> - 2013-09-09 06:59 -0700
        Re: How to generate sound of given frequency? "John B. Matthews" <nospam@nospam.invalid> - 2013-09-09 15:45 -0400
    Re: How to generate sound of given frequency? Roedy Green <see_website@mindprod.com.invalid> - 2013-10-21 20:36 -0700

#2762 — Re: How to generate sound of given frequency?

Fromryanbrummet09@augustana.edu
Date2013-09-03 13:12 -0700
SubjectRe: How to generate sound of given frequency?
Message-ID<57d86ca7-9948-4058-a899-d4c8a2d0c040@googlegroups.com>
Hello,

A little after the fact, but thank you!  I'm wondering why you scaled sin(angular frequency) by vol and 127.  I'm assuming this is because 127 corresponds to the maximum volume setting and vol is the desired amplitude.  Also, why did you reshape the first and last 10ms of the wave?

Again thank you very much. I've spent some time trying to figure this out and your code was the first that I came across that was straight forward.

Sincerely,
Ryan

[toc] | [next] | [standalone]


#2763

From"John B. Matthews" <nospam@nospam.invalid>
Date2013-09-03 22:01 -0400
Message-ID<nospam-A0DF9D.22011203092013@news.aioe.org>
In reply to#2762
In article <57d86ca7-9948-4058-a899-d4c8a2d0c040@googlegroups.com>,
 ryanbrummet09@augustana.edu wrote:

> A little after the fact, but thank you!  I'm wondering why you scaled 
> sin(angular frequency) by vol and 127.  I'm assuming this is because 
> 127 corresponds to the maximum volume setting and vol is the desired 
> amplitude.  Also, why did you reshape the first and last 10ms of the 
> wave?
> 
> Again thank you very much. I've spent some time trying to figure this 
> out and your code was the first that I came across that was straight 
> forward.

Recalling this thread [1] from 2009, you may also like to examine these 
two related examples [2, 3]:

[1] <https://groups.google.com/d/topic/comp.lang.java.help/7vR_AWw1AwQ/discussion>
[2] <http://stackoverflow.com/a/7782749/230513>
[3] <http://stackoverflow.com/a/2065693/230513>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

[toc] | [prev] | [next] | [standalone]


#2764

FromKnute Johnson <nospam@knutejohnson.com>
Date2013-09-03 21:38 -0700
Message-ID<l06dfb$l9o$1@dont-email.me>
In reply to#2762
On 9/3/2013 1:12 PM, ryanbrummet09@augustana.edu wrote:
> Hello,
>
> A little after the fact, but thank you!  I'm wondering why you scaled
> sin(angular frequency) by vol and 127.  I'm assuming this is because
> 127 corresponds to the maximum volume setting and vol is the desired
> amplitude.  Also, why did you reshape the first and last 10ms of the
> wave?
>
> Again thank you very much. I've spent some time trying to figure this
> out and your code was the first that I came across that was straight
> forward.
>
> Sincerely, Ryan
>

The audio format uses signed data one byte in length.  A byte can hold 
values from -128 to 127.  The data is basically amplitude modulation, so 
that a signal from -127 to 127 would be the loudest volume possible. 
The shorter the period of time it takes to make the transition would 
increase the frequency of the tone.

The shaping is to prevent clicks in the sound at the beginning and end 
of the tone.  I should really change the ramp to something more 
logarithmic rather than sawtooth.  The effect I was trying to achieve is 
similar to what is done with continuous wave radio transmission.

-- 

Knute Johnson

[toc] | [prev] | [next] | [standalone]


#2765

FromRoedy Green <see_website@mindprod.com.invalid>
Date2013-09-09 01:46 -0700
Message-ID<6l2r29tmvvrb95ln9gukoijndgk7dvt507@4ax.com>
In reply to#2762
On Tue, 3 Sep 2013 13:12:26 -0700 (PDT), ryanbrummet09@augustana.edu 

see http://mindprod.com/download/products.html#SOUND
for source code to synthetically generate sound.
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Truth is much too complicated to allow anything but approximations. 
 ~ John von Neumann (born: 1903-12-28 died: 1957-02-08 at age: 53)

[toc] | [prev] | [next] | [standalone]


#2766

FromKnute Johnson <nospam@knutejohnson.com>
Date2013-09-09 06:59 -0700
Message-ID<l0kk7u$rd3$1@dont-email.me>
In reply to#2765
On 9/9/2013 1:46 AM, Roedy Green wrote:
> On Tue, 3 Sep 2013 13:12:26 -0700 (PDT), ryanbrummet09@augustana.edu
>
> see http://mindprod.com/download/products.html#SOUND
> for source code to synthetically generate sound.
>

Bad link

-- 

Knute Johnson

[toc] | [prev] | [next] | [standalone]


#2767

From"John B. Matthews" <nospam@nospam.invalid>
Date2013-09-09 15:45 -0400
Message-ID<nospam-6E0AF1.15455709092013@news.aioe.org>
In reply to#2766
In article <l0kk7u$rd3$1@dont-email.me>,
 Knute Johnson <nospam@knutejohnson.com> wrote:

> On 9/9/2013 1:46 AM, Roedy Green wrote:
> > On Tue, 3 Sep 2013 13:12:26 -0700 (PDT), ryanbrummet09@augustana.edu
> >
> > see http://mindprod.com/download/products.html#SOUND
> > for source code to synthetically generate sound.
> 
> Bad link

No cookie! :-)

<http://mindprod.com/jgloss/sound.html>

-- 
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

[toc] | [prev] | [next] | [standalone]


#2825

FromRoedy Green <see_website@mindprod.com.invalid>
Date2013-10-21 20:36 -0700
Message-ID<8lsb69pqjgiii4kuol7ebvqbqj9oq0mohp@4ax.com>
In reply to#2762
On Tue, 3 Sep 2013 13:12:26 -0700 (PDT), ryanbrummet09@augustana.edu
wrote, quoted or indirectly quoted someone who said :

>A little after the fact, but thank you!  I'm wondering why you scaled sin(a=
>ngular frequency) by vol and 127.  I'm assuming this is because 127 corresp=
>onds to the maximum volume setting and vol is the desired amplitude.  Also,=
> why did you reshape the first and last 10ms of the wave?

see http://mindprod.com/products.html#SOUND
-- 
Roedy Green Canadian Mind Products http://mindprod.com
Unlike many machines, computers require no water once they are
manufactured.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.help


csiph-web