* update jmep logic

This commit is contained in:
Seth Call 2016-02-22 20:05:44 -06:00
parent 0cebcb1e29
commit 0cd19e6725
4 changed files with 20 additions and 10 deletions

View File

@ -334,4 +334,5 @@ test_drive_lessons.sql
whitelist.sql
teacher_student_flags.sql
add_sale_source_col.sql
jamblaster_v2.sql
jamblaster_v2.sql
acapella_rename.sql

View File

@ -0,0 +1,2 @@
UPDATE genres set description = 'A Cappella' where id = 'acapella';

View File

@ -176,12 +176,24 @@ module JamRuby
if result_code == 0
bpm = output.to_f
@@log.debug("bpm: #{bpm} start_time: #{start_time}")
offset = 0.140
if bpm >= 60 && bpm < 80
offset = 0.110
elsif bpm >= 80 && bpm < 100
offset = 0.080
elsif bpm >= 100 && bpm < 120
offset = 0.050
elsif bpm >= 120
offset = 0.020
end
metro_fin = "#{Time.at(start_time).utc.strftime("%H:%M:%S")}:#{((start_time - start_time.to_i) * 1000).round}"
@@log.debug("bpm: #{bpm} start_time: #{start_time}, offset: #{offset}")
start_time += offset
metro_fin = "#{Time.at(start_time).utc.strftime("%H:%M:%S")}:#{((start_time - start_time.to_i) * 1000).round.to_s.rjust(3, "0")}"
jmep = ""
jmep << "# created via code using bpm/silence detection (bpm:#{bpm})\r\n"
jmep << "# created via code using bpm/silence detection (bpm:#{bpm} offset:#{offset})\r\n"
jmep << "prelude@10.0 #number of seconds before music starts\r\n"
jmep << "metro_fin@#{metro_fin} bpm=#{bpm}, ticks=8, pmode=stream, name=Beep, play=mono"

View File

@ -79,7 +79,7 @@ namespace :jam_tracks do
end
if path.start_with?('mapped')
JamTrackImporter.storage_format = 'Paris'
JamTrackImporter.storage_format = 'Tency'
end
JamTrackImporter.synchronize_from_meta("#{path}/meta.yml", skip_audio_upload: false)
@ -181,11 +181,6 @@ namespace :jam_tracks do
JamTrackImporter.synchronize_all(skip_audio_upload: false)
end
task sync_tim_tracks: :environment do |task, args|
JamTrackImporter.storage_format = 'TimTracks'
JamTrackImporter.synchronize_all(skip_audio_upload:false)
end
task tency_dups: :environment do |task, args|
end