sidtool 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee52c07a7f399012cf4f38f0be369570784e54086f7bc0c1bb52664b8cbe01b6
4
- data.tar.gz: e5652d2922c9a8b52df256ac1a45074849c81ff256bfdf672bdbdef3c16113ff
3
+ metadata.gz: 5c9e6e4a8741217ee0274bdb1b6fedb7f9c170bf89466b801ad8a1857a7cc59b
4
+ data.tar.gz: f2c57a83771df5654ae6c5e257eeff3ec0d94ae1d9a8db94da58f5eed2e7dee8
5
5
  SHA512:
6
- metadata.gz: 8695db8b9e68e83c550bf4eba49eafbe4f4eef09c2c409eea568365a708d8d7446da573b854c126c2b88fe84d6711c5448ad8b1441272d47c205ef467ec3480b
7
- data.tar.gz: 0f828663808f36e37f20866699fe0abd7c015a87d803c19a994a9589318ad5ba34a91ba0cdbe821d0cae058f7639f5e96f650a8fdbad718f932ec0a1eb7f1f2f
6
+ metadata.gz: bf153ba88e818359ee5df8b32de316959c9215142416a29997b204cc4545210ae33efb01e0a60155c81b1251a398cfe81736e6e1dc08392cfec0396005a3278a
7
+ data.tar.gz: 8533881bb398f17eb54ef530fe3bb23f24fe8bde3214c87ec994da8c35faaa10d4e372fffc99ffab3b23add8f15ce2e268150d1cfa4736afffc159c5b32d44c0
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## 0.0.2
4
+ * Process 15000 frames (10 minutes) instead of 1500 (half a minute) by default.
5
+ * Only release a synth once. This fixes various sound effects that would just end up with a
6
+ permanently released synth. It will probably make "normal" tunes sound a bit crisper too.
7
+ * Ensuring that existing synth gets properly cut off before starting the next sync for a voice.
8
+ This fixes songs like `Commando.sid` that sounded just weird before.
9
+
10
+ ## 0.0.1
11
+ Just getting started... A lot of mess...
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sidtool (0.0.1)
4
+ sidtool (0.0.2)
5
5
  mos6510 (~> 0.1.0)
6
6
 
7
7
  GEM
data/bin/sidtool CHANGED
@@ -3,20 +3,22 @@ require 'sidtool'
3
3
  require 'mos6510'
4
4
  require 'optparse'
5
5
 
6
+ DEFAULT_FRAMES_TO_PROCESS = 15000
7
+
6
8
  params = {}
7
9
  OptionParser.new do |parser|
8
10
  parser.banner = 'Usage: sidtool [options] <intputfile.sid>'
9
11
 
10
12
  parser.on('-i', '--info', 'Show file information')
11
13
  parser.on('-o', '--out FILENAME', 'Output file (Ruby array)')
12
- parser.on('-s', '--song NUMBER', Integer, 'Song number to process')
13
- parser.on('-f', '--frames NUMBER', Integer, 'Number of frames to process')
14
+ parser.on('-s', '--song NUMBER', Integer, 'Song number to process (defaults to the start song in the file)')
15
+ parser.on('-f', '--frames NUMBER', Integer, "Number of frames to process (default #{DEFAULT_FRAMES_TO_PROCESS})")
14
16
  parser.on_tail('-h', '--help', 'Show this message') do
15
17
  puts parser
16
18
  exit
17
19
  end
18
20
  parser.on_tail('--version', 'Show version') do
19
- puts Sidtool::Version
21
+ puts Sidtool::VERSION
20
22
  exit
21
23
  end
22
24
  end.parse!(into: params)
@@ -34,7 +36,7 @@ song = params[:song] || sid_file.start_song
34
36
  raise 'Song must be at least 1' if song < 1
35
37
  raise "File only has #{sid_file.songs} songs" if song > sid_file.songs
36
38
 
37
- frames = params[:frames] || 1500
39
+ frames = params[:frames] || DEFAULT_FRAMES_TO_PROCESS
38
40
 
39
41
  if show_info
40
42
  puts "Read #{sid_file.format} version #{sid_file.version} file."
data/lib/sidtool/synth.rb CHANGED
@@ -19,6 +19,9 @@ module Sidtool
19
19
  end
20
20
 
21
21
  def release!
22
+ return if released?
23
+
24
+ @released_at = STATE.current_frame
22
25
  length_of_attack_decay_sustain = (STATE.current_frame - @start_frame) / FRAMES_PER_SECOND
23
26
  if length_of_attack_decay_sustain < @attack
24
27
  @attack = length_of_attack_decay_sustain
@@ -31,14 +34,22 @@ module Sidtool
31
34
  end
32
35
  end
33
36
 
37
+ def released?
38
+ !!@released_at
39
+ end
40
+
34
41
  def stop!
35
- # TODO: Should also cut off any remaining release
36
- release!
42
+ if released?
43
+ @release = [@release, (STATE.current_frame - @released_at) / FRAMES_PER_SECOND].min
44
+ else
45
+ @release = 0
46
+ release!
47
+ end
37
48
  end
38
49
 
39
50
  def to_a
40
51
  tone = sid_frequency_to_nearest_midi(@frequency)
41
- [@start_frame, tone, @waveform, @attack.round(3), @decay.round(3), @sustain_length, @release.round(3), @controls]
52
+ [@start_frame, tone, @waveform, @attack.round(3), @decay.round(3), @sustain_length.round(3), @release.round(3), @controls]
42
53
  end
43
54
 
44
55
  private
@@ -1,3 +1,3 @@
1
1
  module Sidtool
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/sidtool/voice.rb CHANGED
@@ -18,8 +18,13 @@ module Sidtool
18
18
 
19
19
  def finish_frame
20
20
  if gate
21
+ if @synth&.released?
22
+ @synth.stop!
23
+ @synth = nil
24
+ end
25
+
21
26
  if frequency > 0
22
- unless @synth
27
+ if !@synth
23
28
  @synth = Synth.new(STATE.current_frame)
24
29
  STATE.synths << @synth
25
30
  end
@@ -31,7 +36,6 @@ module Sidtool
31
36
  end
32
37
  else
33
38
  @synth&.release!
34
- @synth = nil
35
39
  end
36
40
  end
37
41
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidtool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ole Friis Østergaard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-31 00:00:00.000000000 Z
11
+ date: 2019-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mos6510
@@ -90,6 +90,7 @@ extra_rdoc_files: []
90
90
  files:
91
91
  - ".gitignore"
92
92
  - ".rspec"
93
+ - CHANGELOG.md
93
94
  - Gemfile
94
95
  - Gemfile.lock
95
96
  - LICENSE.txt