sox-users@lists.sourceforge.net unofficial mirror
 help / color / Atom feed
* Using --combine multiply with a WAV and synth input
@ 2018-09-13  5:25 zoned out
  0 siblings, 0 replies; only message in thread
From: zoned out @ 2018-09-13  5:25 UTC (permalink / raw)
  To: sox-users

[-- Attachment #1.1: Type: text/plain, Size: 2005 bytes --]

Hi,


I'm trying to use "--combine multiply" with two inputs, one a WAV and the other a sinewave at X(offset) frequency.


The WAV is IQ data from SDR (Software Defined Radio) with a samplerate of 1125000, 2 channels, 16 bit.

Here Samplerate=Bandwidth. So 0Hz to 1125000Hz with center frequency at 562500Hz.


The result I'm trying to achieve is frequency translation. That is, move one frequency that is offset from the center frequency to the center frequency.


Currently I can achieve this with the following command lines: (other effects removed for clarity)


Generate sine WAV file with: (Sine @ 392KHz - 2 channel for 10.7 seconds with 1125000 samplerate)

 sox -c 2 -r 1125000 -n offsetsine.wav synth 10.7 sine 392000.0

Combine multiply the sinewave  with WAV with:
 sox --combine multiply sdr_input.wav offsetsine.wav sdr_output

In this example the frequency of interest is at 392000Hz, we multipy it with the sinewave at 392000Hz which shifts it to center or 562500Hz.

This works fine and the result is as expected. With the exception that the generated sinewave file is not 100% with duration.

Now the problem I'm having, these SDR IQ files can be very large (Mb to Gb) and creating a sine file of equal duration (which also is a problem) seems unnecessary if SoX can just generate the sinewave on the fly and multiply it.

Creating this command line is proving troublesome for me.

When I try substituting the 2nd input file for synth and setting length to "0" = "use the input length", all I get is SoX filling HDD and not stopping. The test file I'm using is only 48mb (approx. 10.7 seconds).

This command line does not work:
sox --combine multiply sdr_input.wav -c 2 -r 1125000 -n sdr_output.wav synth 0 sine 392000.0

If I set synth length to 10.7 it does stop but the output is not right at all.


Is what I'm trying to do here achievable with SoX?


Any help with constructing this command line would be appreciated. Thanks in advance.

[-- Attachment #1.2: Type: text/html, Size: 3801 bytes --]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, &quot;EmojiFont&quot;, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, NotoColorEmoji, &quot;Segoe UI Symbol&quot;, &quot;Android Emoji&quot;, EmojiSymbols;">
<p style="margin-top:0; margin-bottom:0">Hi,</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I'm trying to use &quot;--combine multiply&quot; with two inputs, one a WAV and the other a sinewave at X(offset) frequency.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">The WAV is IQ data from SDR (Software Defined Radio) with a samplerate of 1125000, 2 channels, 16 bit.</p>
<p style="margin-top:0; margin-bottom:0">Here Samplerate=Bandwidth. So 0Hz to 1125000Hz with center frequency at 562500Hz.<br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">The result I'm trying to achieve is frequency translation. That is, move one frequency that is offset from the center frequency to the center frequency.</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Currently I can achieve this with the following command lines: (other effects removed for clarity)</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Generate sine WAV file with: (Sine @ 392KHz - 2 channel for 10.7 seconds with 1125000 samplerate)<br>
</p>
<p style="margin-top:0; margin-bottom:0"><span>&nbsp;sox -c 2 -r 1125000 -n offsetsine.wav synth 10.7 sine 392000.0</span><br>
</p>
<p style="margin-top:0; margin-bottom:0"></p>
<div><br>
</div>
<div>Combine multiply the&nbsp;sinewave&nbsp; with WAV with:<br>
</div>
<div>&nbsp;sox --combine multiply sdr_input.wav offsetsine.wav sdr_output</div>
<div><br>
</div>
<div>In this example the frequency of interest is at 392000Hz, we multipy it with the sinewave at 392000Hz which shifts it to center or
<span>562500Hz.</span><br>
</div>
<div><br>
</div>
<div>This works fine and the result is as expected. With the exception that the generated sinewave file is not 100% with duration.</div>
<div><br>
</div>
<div>Now the problem I'm having, these SDR IQ files can be very large (Mb to Gb) and creating a sine file of equal duration (which also is a problem) seems unnecessary if SoX can just generate the sinewave on the fly and multiply it.</div>
<div><br>
</div>
<div>Creating this command line is proving troublesome for me.<br>
</div>
<div><br>
</div>
<div>When I try substituting the 2nd input file for synth and setting length to &quot;0&quot; = &quot;<span><span>use the input length</span></span>&quot;, all I get is SoX filling HDD and not stopping. The test file I'm using is only 48mb (approx. 10.7 seconds).</div>
<div><br>
</div>
<div>This command line does not work:&nbsp; <br>
</div>
sox --combine multiply sdr_input.wav -c 2 -r 1125000 -n sdr_output.wav synth 0 sine 392000.0<br>
<div><br>
</div>
<div>If I set synth length to 10.7 it does stop but the output is not right at all.<br>
</div>
<p></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Is what I'm trying to do here achievable with SoX?<br>
</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">Any help with constructing this command line would be appreciated. Thanks in advance.<br>
</p>
</div>
</body>
</html>

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3: Type: text/plain, Size: 158 bytes --]

_______________________________________________
Sox-users mailing list
Sox-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-users

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-13  5:25 Using --combine multiply with a WAV and synth input zoned out

sox-users@lists.sourceforge.net unofficial mirror

Archives are clonable: git clone --mirror https://public-inbox.org/sox-users

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.audio.sox
	nntp://ou63pmih66umazou.onion/inbox.comp.audio.sox
	nntp://news.gmane.org/gmane.comp.audio.sox

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox