Module: TweetToSounds
- Defined in:
- lib/tweet_to_sounds.rb,
lib/tweet_to_sounds/version.rb,
lib/tweet_to_sounds/sound_finder.rb,
lib/tweet_to_sounds/volume_getter.rb,
lib/tweet_to_sounds/keyword_extractor.rb
Defined Under Namespace
Classes: KeywordExtractor, SoundFinder, VolumeGetter
Constant Summary collapse
- VERSION =
"0.0.1"
Class Attribute Summary collapse
Class Method Summary collapse
- .freesound ⇒ Object
- .freesound_api_key ⇒ Object
- .sounds_for_tweet(tweet) ⇒ Object
- .sounds_for_tweet_with_volumes(tweet) ⇒ Object
Class Attribute Details
.number_of_sounds ⇒ Object
38 39 40 |
# File 'lib/tweet_to_sounds.rb', line 38 def number_of_sounds @number_of_sounds ||= 5 end |
Class Method Details
.freesound ⇒ Object
28 29 30 |
# File 'lib/tweet_to_sounds.rb', line 28 def freesound @freesound ||= Freesound::Client.new(freesound_api_key) end |
.freesound_api_key ⇒ Object
32 33 34 |
# File 'lib/tweet_to_sounds.rb', line 32 def freesound_api_key "f21ede7f1694428ab829e72f52e3d2df" end |
.sounds_for_tweet(tweet) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/tweet_to_sounds.rb', line 11 def sounds_for_tweet(tweet) keywords = KeywordExtractor.new(tweet).keywords sounds = SoundFinder.new(keywords).sounds urls = sounds.map(&:preview_hq_mp3) urls end |
.sounds_for_tweet_with_volumes(tweet) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/tweet_to_sounds.rb', line 19 def sounds_for_tweet_with_volumes(tweet) keywords = KeywordExtractor.new(tweet).keywords sounds = SoundFinder.new(keywords).sounds urls = sounds.map(&:preview_hq_mp3) volumes = VolumeGetter.new(sounds).get_volumes urls.zip(volumes) end |