sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
From: Pander <pander@users.sourceforge.net>
To: sox-devel@lists.sourceforge.net,
	Markus Glugla <markus.glugla@physik.tu-berlin.de>
Subject: Re: spectrogram values
Date: Thu, 28 Jan 2016 17:17:09 +0100	[thread overview]
Message-ID: <95956117-FC80-405F-8B5C-0F18882280F1@users.sourceforge.net> (raw)
In-Reply-To: <1453992442.4360.59.camel@shahbaz-bhatti.xgelb.de>



On 28 January 2016 15:47:22 CET, Markus Glugla <markus.glugla@physik.tu-berlin.de> wrote:
>Am Donnerstag, den 28.01.2016, 14:00 +0100 schrieb Pander:
>> On 01/28/2016 01:51 PM, Markus Glugla wrote:
>> > Am Mittwoch, den 20.01.2016, 03:37 +0100 schrieb Thor Andreassen:
>> >> On Fri, Jan 08, 2016 at 03:31:18PM +0100, Markus Glugla wrote:
>> >>> Hi,
>> >>
>> >> Hi Markus
>> >>  
>> >>> I read the spectrogram threads and affiliate a request. I'm using
>> >>> sometimes sox spectrogram to get an spectral overview of various
>> >>> measurement datas. But i want to plot the spectrogram with other
>tools
>> >>> e.g. gnuplot.
>> >>>
>> >>> I would be very grateful if it were possible to output the
>spectrogram
>> >>> data as plotable values in a file or stream. Does anybody have
>the
>> >>> same intention and more experience than me to produce a patch?
>> >>
>> >> I have been planning to implement an amplitude and water-fall
>output,
>> >> that can be sent to Gnuplot. I will need these in the coming
>months, so
>> >> perhaps it will get done.
>> >>
>> >> A crude way of getting the raw numbers could be to use the color
>values
>> >> from the generated png file, e.g. with Imagemagick:
>> >>
>> >>     sox -n -n synth 1 synth 1k:5k spectrogram -r -o - |
>> >>     convert png:- txt:-                 |
>> >>     
>> >>     # translate into Gnuplot compatible input
>> >>     awk -v FS='[,:() ]+' 'NR > 2               { print $1, $2,
>($3+$4+$5)/3 }'  |
>> >>     awk                  'NR > 2 && $2 != prev { printf "\n" } {
>prev = $2 } 1' \
>> >>     > spectrogram.dat
>> >>
>> >> Note the use of the `-r` option to sox, which omits all
>decorations. See
>> >> `sox --help-effect spectrogram` for more.
>> >>
>> >> Now plot the data file with Gnuplot:
>> >>
>> >>     echo 'splot "spectrogram.dat" with pm3d' | gnuplot --persist
>> >>
>> >> If you want to get at the raw spectrogram, you need to patch
>> >> spectrogram.c. The attached patch works best with single channel
>files.
>> >> Use the new `-O filename` switch to save the binary data.
>> >>
>> >> The default output is a sequence of floats which are 4 bytes long.
>This
>> >> is also Gnuplots default for binary input. This means you can plot
>the
>> >> output like this:
>> >>
>> >>     echo 'plot "<sox -n -n synth 1 sine 1k:5k spectrogram -O -" \
>> >>             binary array=(513,800) flipy rotation=90d with image'
>|
>> >>     gnuplot --persist
>> >>
>> >> Note that if your output from sox is short, the spectrogram
>dimensions
>> >> will be different from 800x513 and Gnuplot will barf.
>> >>
>> > Hi Thor
>> > 
>> > Thank you for your source code and your patch. I enjoy about your
>idea
>> > which increases the productivity. 
>> > 
>> > It is also in my opinion to use gnuplot as plotting tool to create
>> > spectrogram in the same, my, style.
>> > 
>> > I also think about the grab the spectrogram datas via imagemagick.
>But
>> > in this case it is easier to use GSL.
>> > 
>> > Thank you for your help. Your code snippets are very informative.
>> > 
>> > Markus
>> 
>> Make sure to validate what the impact is of including or omitting the
>> last sample as it often is not complete and distorts the spectrum,
>see
>> my earlier analysis with graphs illustrating that.
>> 
>
>I read your hints, thank you very much. 
>
>I think, it is typical of FFT which needs a even number of samples
>(2n).
>On short sequences, the 2n FFT array is longer than the sequence you
>get
>also porblems. A FFT with a number of less than 2n will be incorrect. I
>think it's better to cut the sequence on right position to 2n before
>FFT, is'nt? What is with windowing?

More combination are OK, it is just theast sample that is dangerous. So safest is to skip it. That means either calculating the number of samples or parseing it twice or with a delay. 

>
>Thank you for your hint,
>Markus
>
>
>> > 
>> > 
>> >
>------------------------------------------------------------------------------
>> > Site24x7 APM Insight: Get Deep Visibility into Application
>Performance
>> > APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> > Monitor end-to-end web transactions and take corrective actions now
>> > Troubleshoot faster and improve end-user experience. Signup Now!
>> > http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>> > _______________________________________________
>> > SoX-devel mailing list
>> > SoX-devel@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/sox-devel
>> > 
>> 
>> 
>>
>------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application
>Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>> _______________________________________________
>> SoX-devel mailing list
>> SoX-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/sox-devel
>
>
>
>------------------------------------------------------------------------------
>Site24x7 APM Insight: Get Deep Visibility into Application Performance
>APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>Monitor end-to-end web transactions and take corrective actions now
>Troubleshoot faster and improve end-user experience. Signup Now!
>http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>_______________________________________________
>SoX-devel mailing list
>SoX-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/sox-devel


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

      reply	other threads:[~2016-01-28 16:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 14:31 spectrogram values Markus Glugla
2016-01-20  2:37 ` Thor Andreassen
2016-01-21 15:33   ` Pander
2016-01-22 23:54     ` Thor Andreassen
2016-01-26 12:24       ` Pander
2016-01-22 17:38   ` Thor Andreassen
2016-01-28 12:51   ` Markus Glugla
2016-01-28 13:00     ` Pander
2016-01-28 14:47       ` Markus Glugla
2016-01-28 16:17         ` Pander [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95956117-FC80-405F-8B5C-0F18882280F1@users.sourceforge.net \
    --to=sox-devel@lists.sourceforge.net \
    --cc=markus.glugla@physik.tu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).