# data[].attributes.attachment_link.readable_text
#SONIC SKETCH 1

#male
use_synth :piano
play :C2
sleep 2
#female
use_synth :piano
play :C4


use_synth :piano
play :C3
sleep 2
use_synth :piano
play :C1
use_synth :piano
play :C7
sleep 2
use_synth :piano
play :C5
sleep 2
use_synth :piano
play :C6
use_synth :piano
play :E3
sleep 2
use_synth :piano
play :E4

# data[].attributes.attachment_link.readable_text
#SONIC SKETCH 2

# Play the tick sound
define :play_tick do |duration, sleep_time, num_ticks|
  with_fx :reverb, mix: 0.5 do
    num_ticks.times do
      sample :elec_tick, amp: 2, release: duration, sustain: 0
      sleep sleep_time
    end
  end
end


in_thread do
  play_tick(0.2, 0.1, 1)
end
sleep 2
in_thread do
  play_tick(0.2, 0.1, 2)
end
sleep 2
in_thread do
  play_tick(0.2, 0.1, 3)
end

# data[].attributes.body
Getting to know the data:

This data was collected by listening to the sounds of 21 different cats (but only two breeds).   This data tells us the “meows” when the cat is being brushed, isolated in an unfamiliar room, or when they are waiting for food.  This data can tell us how the cats react to each situation vocally.  We can find that there are 127 brush meows, 92 meows in an isolated unfamiliar room, and 221 meows waiting for food. For grouping, I would put the data on a Google sheet and organize it by main category first, then gender, and recording group.  The cats meow the most when they are waiting for food, there are 345 females and 95 males, and the cats meow the least when they are in an unfamiliar room.

# data[].attributes.attachment_link.readable_text
# Define the folder path where your sound files are located
folder_path = "C:/Users/ellas/Downloads/dataset (1)/dataset/"

# Initialize global variables for file counts
file_counts = {}
files_to_play = [
  "B_ANI01_MC_FN_SIM01_101.wav",
  "B_ANI01_MC_FN_SIM01_102.wav",
  "B_IND01_EU_MN_ELI01_103.wav",
  "B_IND01_EU_FN_ELI01_201.wav",
  "B_IND01_EU_MN_ELI01_202.wav",
  "B_IND01_EU_MN_ELI01_203.wav",
  "B_IND01_EU_FN_ELI01_301.wav",
  "B_IND01_EU_MN_ELI01_302.wav",
  "B_IND01_EU_FN_ELI01_303.wav",
  "B_IND01_EU_MN_ELI01_304.wav",
  "F_IND01_EU_FN_ELI01_302.wav",
  "F_IND01_EU_FN_ELI01_304.wav",
  "F_LEO01_EU_MI_RIT01_301.wav",
  "F_LEO01_EU_MI_RIT01_102.wav",
  "F_LEO01_EU_FI_RIT01_103.wav",
  "F_LEO01_EU_FI_RIT01_104.wav",
  "F_LEO01_EU_MI_RIT01_205.wav",
  "F_MAG01_EU_FN_FED01_201.wav",
  "F_MAG01_EU_MN_FED01_202.wav",
  "I_ANI01_MC_FN_SIM01_101.wav",
  "I_ANI01_MC_MN_SIM01_102.wav",
  "I_ANI01_MC_FN_SIM01_103.wav",
  "I_ANI01_MC_FN_SIM01_304.wav",
  "I_BAC01_MC_MN_SIM01_301.wav",
  "I_BAC01_MC_MN_SIM01_302.wav",
  "I_BAC01_MC_FN_SIM01_203.wav",
  "I_BAC01_MC_MN_SIM01_201.wav",
  "I_BAC01_MC_FN_SIM01_202.wav"
  
]

# Play the tick sound
define :play_tick do |duration, sleep_time, num_ticks|
  with_fx :reverb, mix: 0.5 do
    num_ticks.times do
      sample :elec_tick, amp: 2, release: duration, sustain: 0
      sleep sleep_time
    end
  end
end

# Loop through the list of files and play them
live_loop :play_files do
  files_to_play.each do |file|
    # FIND MALE N
    if file.include?("_MN_")
      use_synth :piano
      play :C2
      gain = 1
      
      #INCLUDE RECORDING 1
      if file.include?("_1")
        in_thread do
          play_tick(0.2, 0.1, 1)
        end
        #INCLUDE SITUATION NOISES
        if file.include?("B_")
          stretch_factor = 3
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
        elsif file.include?("F_")
          stretch_factor = 1
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
        #INCLUDE RECORDING 2
      elsif file.include?("_2")
        in_thread do
          play_tick(0.2, 0.1, 2)
        end
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
        #INCLUDE RECORDING 3
      elsif file.include?("_3")
        in_thread do
          play_tick(0.2, 0.1, 3)
        end
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
      end
      
      #FIND MALE I
    elsif file.include?("_MI_")
      use_synth :piano
      play :C2
      gain = 1
      #INCLUDE RECORDING 1
      if file.include?("_1")
        in_thread do
          play_tick(0.2, 0.1, 1)
        end
        # SETTING B
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
          # SETTING F
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
          # SETTING I
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
        #INCLUDE RECORDING 2
      elsif file.include?("_2")
        in_thread do
          play_tick(0.2, 0.1, 2)
        end
        # SETTING B
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
          # SETTING F
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
          # SETTING I
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
        #INCLUDE RECORDING 3
      elsif file.include?("_3")
        in_thread do
          play_tick(0.2, 0.1, 3)
        end
        # SETTING B
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
          # SETTING F
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
          # SETTING I
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
      end
      
      #FIND FEMALE I
    elsif file.include?("_FI_")
      use_synth :piano
      play :C4
      gain = 1
      #INCLUDE RECORDING 1
      if file.include?("_1")
        in_thread do
          play_tick(0.2, 0.1, 1)
        end
        # SETTING B
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
          # SETTING F
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
          # SETTING I
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
        #INCLUDE RECORDING 2
      elsif file.include?("_2")
        in_thread do
          play_tick(0.2, 0.1, 2)
        end
        # SETTING B
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
          # SETTING F
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
          # SETTING I
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
        #INCLUDE RECORDING 3
      elsif file.include?("_3")
        in_thread do
          play_tick(0.2, 0.1, 3)
        end
        # SETTING B
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
          # SETTING F
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
          # SETTING I
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
      end
      
      #FIND FEMALE N
    elsif file.include?("_FN_")
      use_synth :piano
      play :C4
      gain = 1
      #INCLUDE RECORDING 1
      if file.include?("_1")
        in_thread do
          play_tick(0.2, 0.1, 1)
        end
        # SETTING B
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
          # SETTING F
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
          # SETTING I
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
        #INCLUDE RECORDING 2
      elsif file.include?("_2")
        in_thread do
          play_tick(0.2, 0.1, 2)
        end
        # SETTING B
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
          # SETTING F
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
          # SETTING I
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
        #INCLUDE RECORDING 3
      elsif file.include?("_3")
        in_thread do
          play_tick(0.2, 0.1, 3)
        end
        # SETTING B
        if file.include?("B_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/389452__lzmraul__brushing.wav", beat_stretch: stretch_factor
          # SETTING F
        elsif file.include?("F_")
          stretch_factor = 2
          sample "C:/Users/ellas/Downloads/382007__jmcv__jmcv_nibbling_smallanimal.mp3", beat_stretch: stretch_factor
          # SETTING I
        elsif file.include?("I_")
          sample "C:/Users/ellas/Downloads/420875__inspectorj__gathering-ice-a.wav"
        end
      end
    end
    
    # Sleep for a fixed duration
    sleep 2
  end
end
