diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-09-10 15:03:30 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-09-10 15:03:30 +0000 |
commit | 68e943265edf04e63a8e8b8f62bab20f99d9c637 (patch) | |
tree | ff8941a59662fc0c4622944b65f7b2d5e3bdd0c3 /tools/synthesize_sources.pl | |
parent | e4372df05b7d74a6b80dbbf4b6c00cc2b31c4723 (diff) |
merge from 2.0-ongoing @ 3581
git-svn-id: svn://localhost/ardour2/branches/3.0@3711 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'tools/synthesize_sources.pl')
-rwxr-xr-x | tools/synthesize_sources.pl | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/tools/synthesize_sources.pl b/tools/synthesize_sources.pl index ebb903cf37..3123d0cb1f 100755 --- a/tools/synthesize_sources.pl +++ b/tools/synthesize_sources.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl # Ardour session synthesizer -# (c)Sampo Savolainen 2007 +# (c)Sampo Savolainen 2007-2008 # # GPL # This reads an Ardour session file and creates zero-signal source files @@ -13,14 +13,31 @@ use IO::Handle; use ARDOUR::SourceInfoLoader; +my $usage = "usage: synthesize_sources.pl samplerate [session name, the name must match the directory and the .ardour file in it] [options: -sine for 440hz sine waves in wave files]\n"; -my ($samplerate, $sessionName) = @ARGV; +my ($samplerate, $sessionName, @options) = @ARGV; if ( ! -d $sessionName || ! -f $sessionName."/".$sessionName.".ardour" ) { - print "usage: synthesize_sources.pl samplerate [session name, the name must match the directory and the .ardour file in it]\n"; + print $usage; exit; } +my $waveType = "silent"; + +foreach my $o (@options) { + if ($o eq "-sine") { + $waveType = "sine"; + } elsif ($o eq "-silent") { + $waveType = "silent"; + } else { + print "unknown parameter ".$o."\n"; + print $usage; + exit; + + } + +} + my $sessionFile = $sessionName."/".$sessionName.".ardour"; @@ -52,9 +69,10 @@ my %sources = %{$handler->{Sources}}; foreach my $tmp (keys %sources) { - print "Generating ".$audioFileDirectory."/".$sources{$tmp}->{name}.".wav\n"; + print "Generating ".$audioFileDirectory."/".$sources{$tmp}->{name}."\n"; - system("sox", + my @cmd = + ("sox", "-t", "raw", # /dev/zero is raw :) "-r", $samplerate, # set sample rate "-c", "1", # 1 channel @@ -68,7 +86,11 @@ foreach my $tmp (keys %sources) { "trim", "0", $sources{$tmp}->{calculated_length}."s" # trim silence to wanted sample amount ); + if ($waveType eq "sine") { + @cmd = (@cmd, "synth","sin","%0", "vol", "0.2", "fade","q","0.01s", $sources{$tmp}->{calculated_length}."s" , "0.01s"); + } + system(@cmd); } |