Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved]To grab the output from a code to a wave file?

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
bkpsusmitaa
Posts: 485
Joined: 2009-07-04 06:32
Location: Home: Barrackpore and Mysore
Has thanked: 5 times

[Solved]To grab the output from a code to a wave file?

#1 Post by bkpsusmitaa »

Within this present thread itself, I sent my original post to my immediately next post below it.

I had to do this because the BB-code doesn't allow the Subject/Thread Title to be changed independently of the first post on that thread.

The independence is required because the solution is likely at the bottom of any thread, not at the top.

The solution to this query is at the last post within this thread.
Last edited by bkpsusmitaa on 2018-09-08 07:58, edited 4 times in total.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home

bkpsusmitaa
Posts: 485
Joined: 2009-07-04 06:32
Location: Home: Barrackpore and Mysore
Has thanked: 5 times

The man file appears to be too cryptic to comprehend

#2 Post by bkpsusmitaa »

Hello, friends.
Open a terminal. Copy-paste the code:

Code: Select all

nohup play -n synth brownnoise synth pinknoise mix synth sine amod 0.3 20
I may use multiple terminals, all playing the same sound at a mutual time-lapse with each other.
I want to grab the output audio using a terminal to a wave file.
How can I do it?
Can be done with using Sox's "rec" utility:

Code: Select all

rec -c 2  myFile.mp3
Very good noise quality for sleeping and relaxing.

Question is: How to combine the two codes for an output file with the combined sounds in myFile.mp3?
The following special filenames may be used in certain circumstances in place of a normal filename on the command line:
-

SoX can be used in simple pipeline operations by using the special filename '-' which, if used in place of an input filename, will cause SoX will read audio data from 'standard input' (stdin), and which, if used in place of the output filename, will cause SoX will send audio data to 'standard output' (stdout). Note that when using this option, the file-type (see -t below) must also be given.
"|program [options] ..."
This can be used in place of an input filename to specify the the given program's standard output (stdout) be used as an input file. Unlike - (above), this can be used for several inputs to one SoX command. For example, if 'genw' generates mono WAV formatted signals to its standard output, then the following command makes a stereo file from two generated signals:

Code: Select all

    sox -M -t wav "|genw --imd -" -t wav "|genw --thd -" out.wav
If -t is not given then the signal is assumed (and checked) to be in SoX's native .sox format (see -p below and soxformat(7)).
But can't make head or tail of either genw, imd or thd. And like man pages are cryptic, this one is also cryptic.
Last edited by bkpsusmitaa on 2018-09-08 07:51, edited 3 times in total.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home

bkpsusmitaa
Posts: 485
Joined: 2009-07-04 06:32
Location: Home: Barrackpore and Mysore
Has thanked: 5 times

Re: To grab the output from a code to a wave file?

#3 Post by bkpsusmitaa »

Why is my default input being shown as pulseaudio? Why not stdin?

Code: Select all

rec -c 2 myFile.mp3
Input File : 'default' (pulseaudio)
Channels : 2
Sample Rate : 48000
Precision : 16-bit
Sample Encoding: 16-bit Signed Integer PCM
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home

bkpsusmitaa
Posts: 485
Joined: 2009-07-04 06:32
Location: Home: Barrackpore and Mysore
Has thanked: 5 times

Re: To grab the output from a code to a wave file?

#4 Post by bkpsusmitaa »

The solution for recording is the same as that collected in the thread: [Solved]Full Duplex sound playback recording config?
Last edited by bkpsusmitaa on 2018-09-08 09:47, edited 1 time in total.
Freedom is impossible to conceive.
Books that help:
Dale Carnegie's How To Win Friends And Influence People and Emilie Post's Etiquette In Society, In Business, In Politics, And At Home

Post Reply