# DecibelsChallenge_SpaceLaunches

# Space Launches and frequencies

For the Second Decibels Challenge, the dataset provided was from [OurWorldInData](https://ourworldindata.org/grapher/yearly-number-of-objects-launched-into-outer-space?country=OWID_WRL~USA~RUS~CHN~GBR~JPN~FRA~IND~DEU~European+Space+Agency)

<iframe width="100%" height="300" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/1572517507&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>

[IllestPreacha](https://soundcloud.com/llestreacha) · [Space Launch Frequencies](https://soundcloud.com/llestreacha/sets/space-launch-frequencies)

## **Sonification Steps**

* While cleaning the data in Python, I decided to make 8 CSV Files
    
    * 1 for each of the 6 Continents
        
    * 1 for the Space Agencies
        
    * 1 for the total launches in the world
        
* For the Sonification in Sonic Pi, I decided to track the frequency of all the countries and agencies that participated in a launch during a single year. With the earlier cleaning, this was done per region and in intervals of four years (simulating the Olympics), with each year in a cycle being represented by a different sound.
    
    * There are three distinct sounds in the 8 Sonifications
        
        * Originally the sounds included the bd dub sound
            
        * Then for the next set, that sound was replaced with a drone-type sound
            
        * For the world launches, the sounds are still in intervals but they are also pitched to represent the higher frequency of launches per year
            

## SonicPi Code

### Set 1 ( African, Asian & European Launches)

```ruby
require 'csv'

#reading the csv fields
AfricanSpaceLaunch = CSV.parse(File.read("C:/Creatuve Code Challenges/Sonification Challenges/Febuary 2023/African_SpaceObject.csv"),headers: true)
#AsianSpaceLaunch = CSV.parse(File.read("C:/Creatuve Code Challenges/Sonification Challenges/Febuary 2023/Asian_SpaceObject.csv"),headers: true)
#making a counter
i = 0

live_loop :ASL do
  with_fx :flanger do
    with_fx :reverb do

      puts AfricanSpaceLaunch[i]['Year']
      #now going to give distinct sounds to the year based on a 4 year sound
      #giving decay effect to show how some years it lingers more

     #case is set to the interval of four years
      case AfricanSpaceLaunch[i]['Year'].to_f % 4
      when 0
        sample :bd_808, decay: AfricanSpaceLaunch[i]['yearly_launches'].to_f
      when 1
        sample :ambi_dark_woosh, decay: AfricanSpaceLaunch[i]['yearly_launches'].to_f
      when 2
        sample :drum_snare_hard, decay: AfricanSpaceLaunch[i]['yearly_launches'].to_f
      when 3
        sample :elec_bell, decay: AfricanSpaceLaunch[i]['yearly_launches'].to_f
      else
        sample :elec_ping, decay: AfricanSpaceLaunch[i]['yearly_launches'].to_f
      end
      #counter based on the amount of rows
      if i >= 27
        i = 0
      end
      i += 1
      sleep 0.5
    end
  end
end
```

### Set 2 ( Oceanic, Agencies, North American & South American Launches)

```ruby
require 'csv'

#reading the csv fields
OSL = CSV.parse(File.read("C:/Creatuve Code Challenges/Sonification Challenges/Febuary 2023/Oceanic_SpaceObject.csv"),headers: true)
#making a counter
i = 0

#after first three swapped out the bd_dub for a drone sound

live_loop :OSL do
  with_fx :flanger do
    with_fx :reverb do
      puts OSL[i]['Year']
      #now going to give distinct sounds to the year based on a 4 year sound
      #giving decay effect to show how some years it lingers more

    #case is set to the interval of four years
      case OSL[i]['Year'].to_f % 4
      when 0
        sample :ambi_drone, decay: OSL[i]['yearly_launches'].to_f
      when 1
        sample :ambi_dark_woosh, decay: OSL[i]['yearly_launches'].to_f
      when 2
        sample :drum_snare_hard, decay: OSL[i]['yearly_launches'].to_f
      when 3
        sample :elec_bell, decay: OSL[i]['yearly_launches'].to_f
      else
        sample :elec_ping, decay: OSL[i]['yearly_launches'].to_f
      end
         #counter based on the amount of rows
      if i >= 25
        i = 0
      end
      i += 1
      sleep 0.5
    end
  end
end
```

### Set 3 ( World Launches)

```ruby
require 'csv'

#reading the csv fields
W = CSV.parse(File.read("C:/Creatuve Code Challenges/Sonification Challenges/Febuary 2023/World_SpaceObject.csv"),headers: true)
#making a counter
i = 0

#for the world decided to do something a little different
#it still follows the dividing the data into intervals of 4 but uses notes to describe the intensity

live_loop :AOSL, amp: 6 do
  with_fx :flanger do
    with_fx :reverb do

      puts W[i]['Year']
#case is set to the interval of four years
      case W[i]['Year'].to_f % 4
      when 0
        use_synth :piano
        play W[i]['yearly_launches'].to_f / 10
      when 1
        use_synth :chipnoise
        play W[i]['yearly_launches'].to_f / 10
      when 2
        use_synth :chiplead
        play W[i]['yearly_launches'].to_f / 10
      when 3
        use_synth :pretty_bell
        play W[i]['yearly_launches'].to_f / 10
      else
        use_synth :piano
        play W[i]['yearly_launches'].to_f / 10
      end
      #counter based on the amount of rows
      if i >= 65
        i = 0
      end
      i += 1
      sleep 1
    end
  end
end
```

## Python Data Cleaning Code

```python
#reading the csv file

import pandas as pd
df = pd.read_csv("SpaceObjects.csv")
print(df)
```

Entity Code Year yearly\_launches 0 Algeria DZA 2002 1 1 Algeria DZA 2010 1 2 Algeria DZA 2016 3 3 Algeria DZA 2017 1 4 Angola AGO 2017 1 ... ... ... ... ... 1114 World OWID\_WRL 2018 453 1115 World OWID\_WRL 2019 586 1116 World OWID\_WRL 2020 1274 1117 World OWID\_WRL 2021 1810 1118 World OWID\_WRL 2022 2163

\[1119 rows x 4 columns\]

```python
#getting information on the type of columns and the amount
df.info()
```

&lt;class 'pandas.core.frame.DataFrame'&gt; RangeIndex: 1119 entries, 0 to 1118 Data columns (total 4 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Entity 1119 non-null object 1 Code 981 non-null object 2 Year 1119 non-null int64 3 yearly\_launches 1119 non-null int64 dtypes: int64(2), object(2) memory usage: 35.1+ KB

```python
#getting information from the csv
df.describe()
```

|  | Year | yearly\_launches |
| --- | --- | --- |
| count | 1119.000000 | 1119.000000 |
| mean | 2001.115282 | 25.587131 |
| std | 16.517192 | 124.276918 |
| min | 1957.000000 | 1.000000 |
| 25% | 1991.000000 | 1.000000 |
| 50% | 2005.000000 | 2.000000 |
| 75% | 2015.000000 | 6.000000 |
| max | 2022.000000 | 2163.000000 |

```python
df.Entity.unique()
```

array(\['Algeria', 'Angola', 'Arabsat', 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan', 'Bangladesh', 'Belarus', 'Belgium', 'Bhutan', 'Bolivia', 'Brazil', 'Bulgaria', 'Canada', 'Chile', 'China', 'Colombia', 'Costa Rica', 'Czechia', 'Denmark', 'EUMETSAT', 'Ecuador', 'Egypt', 'Estonia', 'Ethiopia', 'European Space Agency', 'European Union', 'Eutelsat', 'Finland', 'France', 'Germany', 'Ghana', 'Greece', 'Guatemala', 'Hungary', 'India', 'Indonesia', 'Inmarsat', 'Intelsat', 'Intersputnik', 'Iran', 'Israel', 'Italy', 'Japan', 'Jordan', 'Kazakhstan', 'Kenya', 'Laos', 'Latvia', 'Lithuania', 'Luxembourg', 'Malaysia', 'Mauritius', 'Mexico', 'Moldova', 'Monaco', 'Mongolia', 'Morocco', 'NATO', 'Nepal', 'Netherlands', 'New Zealand', 'Nigeria', 'North Korea', 'Norway', 'Pakistan', 'Papua New Guinea', 'Paraguay', 'Peru', 'Philippines', 'Poland', 'Portugal', 'Qatar', 'RASCOM', 'Romania', 'Russia', 'Rwanda', 'Saudi Arabia', 'Sea Launch', 'Singapore', 'Slovakia', 'Slovenia', 'South Africa', 'South Korea', 'Spain', 'Sri Lanka', 'Starsem', 'Sweden', 'Switzerland', 'Taiwan', 'Thailand', 'Tunisia', 'Turkey', 'Turkmenistan', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States', 'Uruguay', 'Venezuela', 'Vietnam', 'World'\], dtype=object)

```python
'''
African Countries

'Algeria', 'Angola', 'Ethiopia', 'Ghana', 'Egypt', 'Morocco', 'Mauritius', 'Nigeria', 'South Africa'.

European Countries:
'Austria', 'Belarus', 'Belgium', 'Bulgaria', 'Czechia', 'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 
'Greece', 'Hungary', 'Italy', 'Lithuania', 'Luxembourg', 'Monaco', 'Netherlands', 'Norway', 'Poland', 
'Portugal', 'Romania', 'Russia', 'Slovakia', 'Slovenia', 'Spain', 'Sweden', 'Switzerland', 'Ukraine', 'United Kingdom'

North American Countries:
'Canada', 'Costa Rica', 'Mexico', 'United States'.

South American Countries:
'Argentina', 'Bolivia', 'Brazil', 'Chile', 'Colombia', 'Ecuador', 'Paraguay', 'Peru', 'Uruguay', 'Venezuela'.

Asian Countries:
'Arabsat', 'Bangladesh', 'Bhutan', 'China', 'India', 'Indonesia', 'Iran', 'Israel', 'Japan', 
'Jordan', 'Kazakhstan', 'Laos', 'Malaysia', 'North Korea', 'Pakistan', 'Philippines', 'Singapore', 
'South Korea', 'Taiwan', 'Thailand', 'Turkey', 'Turkmenistan', 'Vietnam'.

Oceanic Countries:
'Australia', 'New Zealand'.

The non-countries in the list are:
'Arabsat', 'EUMETSAT', 'European Space Agency', 'European Union', 'Eutelsat', 'Inmarsat', 
'Intelsat', 'Intersputnik', 'NATO', 'RASCOM', 'Sea Launch', 'Starsem', 'World'.

'''
```

"\\nAfrican Countries\\n\\n'Algeria', 'Angola', 'Ethiopia', 'Ghana', 'Egypt', 'Morocco', 'Mauritius', 'Nigeria', 'South Africa'.\\n\\nEuropean Countries:\\n'Austria', 'Belarus', 'Belgium', 'Bulgaria', 'Czechia', 'Denmark', 'Estonia', 'Finland', 'France', 'Germany', \\n'Greece', 'Hungary', 'Italy', 'Lithuania', 'Luxembourg', 'Monaco', 'Netherlands', 'Norway', 'Poland', \\n'Portugal', 'Romania', 'Russia', 'Slovakia', 'Slovenia', 'Spain', 'Sweden', 'Switzerland', 'Ukraine', 'United Kingdom'\\n\\nNorth American Countries:\\n'Canada', 'Costa Rica', 'Mexico', 'United States'.\\n\\nSouth American Countries:\\n'Argentina', 'Bolivia', 'Brazil', 'Chile', 'Colombia', 'Ecuador', 'Paraguay', 'Peru', 'Uruguay', 'Venezuela'.\\n\\nAsian Countries:\\n'Arabsat', 'Bangladesh', 'Bhutan', 'China', 'India', 'Indonesia', 'Iran', 'Israel', 'Japan', \\n'Jordan', 'Kazakhstan', 'Laos', 'Malaysia', 'North Korea', 'Pakistan', 'Philippines', 'Singapore', \\n'South Korea', 'Taiwan', 'Thailand', 'Turkey', 'Turkmenistan', 'Vietnam'.\\n\\nOceanic Countries:\\n'Australia', 'New Zealand'.\\n\\nThe non-countries in the list are:\\n'Arabsat', 'EUMETSAT', 'European Space Agency', 'European Union', 'Eutelsat', 'Inmarsat', \\n'Intelsat', 'Intersputnik', 'NATO', 'RASCOM', 'Sea Launch', 'Starsem', 'World'.\\n\\n"

```python
#making new dataframes by breaking the it into Continents and Agencies

African = df[df["Entity"].isin(['Algeria', 'Angola', 'Ethiopia', 'Ghana', 'Egypt', 'Morocco', 'Mauritius', 'Nigeria', 'South Africa'])]

NorthAmerican = df[df["Entity"].isin(['Canada', 'Costa Rica', 'Mexico', 'United States'])]

SouthAmerican = df[df["Entity"].isin(['Argentina', 'Bolivia', 'Brazil', 'Chile', 'Colombia', 'Ecuador', 'Paraguay', 'Peru', 'Uruguay', 'Venezuela'])]

European = df[df["Entity"].isin(['Austria', 'Belarus', 'Belgium', 'Bulgaria', 'Czechia', 'Denmark', 'Estonia', 'Finland', 'France', 'Germany', 
'Greece', 'Hungary', 'Italy', 'Lithuania', 'Luxembourg', 'Monaco', 'Netherlands', 'Norway', 'Poland', 
'Portugal', 'Romania', 'Russia', 'Slovakia', 'Slovenia', 'Spain', 'Sweden', 'Switzerland', 'Ukraine', 'United Kingdom'])]
              
Asian = df[df["Entity"].isin(['Bangladesh', 'Bhutan', 'China', 'India', 'Indonesia', 'Iran', 'Israel', 'Japan', 
'Jordan', 'Kazakhstan', 'Laos', 'Malaysia', 'North Korea', 'Pakistan', 'Philippines', 'Singapore', 
'South Korea', 'Taiwan', 'Thailand', 'Turkey', 'Turkmenistan', 'Vietnam'])]

Oceanic = df[df["Entity"].isin(['Australia', 'New Zealand'])]

Agencies = df[df["Entity"].isin(['Arabsat', 'EUMETSAT', 'European Space Agency', 'European Union', 'Eutelsat', 'Inmarsat', 
'Intelsat', 'Intersputnik', 'NATO', 'RASCOM', 'Sea Launch', 'Starsem'])]

World = df[df["Entity"].isin(['World'])]
```

```python
#sorted by year
African = African.sort_values(by=['Year'],ascending=True)
NorthAmerican = NorthAmerican.sort_values(by=['Year'],ascending=True)
SouthAmerican = SouthAmerican.sort_values(by=['Year'],ascending=True)
European = European.sort_values(by=['Year'],ascending=True)
Asian = Asian.sort_values(by=['Year'],ascending=True)
Oceanic = Oceanic.sort_values(by=['Year'],ascending=True)
Agencies = Agencies.sort_values(by=['Year'],ascending=True)
World = World.sort_values(by=['Year'],ascending=True)
```

```python
African.head()
```

|  | Entity | Code | Year | yearly\_launches |
| --- | --- | --- | --- | --- |
| 218 | Egypt | EGY | 1998 | 1 |
| 814 | South Africa | ZAF | 1999 | 1 |
| 219 | Egypt | EGY | 2000 | 1 |
| 663 | Morocco | MAR | 2001 | 1 |
| 0 | Algeria | DZA | 2002 | 1 |

```python
World.describe()
```

|  | Year | yearly\_launches |
| --- | --- | --- |
| count | 66.000000 | 66.000000 |
| mean | 1989.500000 | 216.378788 |
| std | 19.196354 | 357.906725 |
| min | 1957.000000 | 2.000000 |
| 25% | 1973.250000 | 108.250000 |
| 50% | 1989.500000 | 134.500000 |
| 75% | 2005.750000 | 158.000000 |
| max | 2022.000000 | 2163.000000 |

```python
African.describe()
```

|  | Year | yearly\_launches |
| --- | --- | --- |
| count | 28.000000 | 28.000000 |
| mean | 2012.607143 | 1.285714 |
| std | 7.563750 | 0.762896 |
| min | 1998.000000 | 1.000000 |
| 25% | 2008.500000 | 1.000000 |
| 50% | 2015.000000 | 1.000000 |
| 75% | 2018.000000 | 1.000000 |
| max | 2022.000000 | 4.000000 |

```python
NorthAmerican.describe()
```

|  | Year | yearly\_launches |
| --- | --- | --- |
| count | 118.000000 | 118.000000 |
| mean | 1994.364407 | 62.991525 |
| std | 18.664682 | 219.515103 |
| min | 1958.000000 | 1.000000 |
| 25% | 1978.250000 | 2.000000 |
| 50% | 1996.000000 | 18.000000 |
| 75% | 2011.000000 | 35.750000 |
| max | 2022.000000 | 1796.000000 |

```python
SouthAmerican.describe()
```

|  | Year | yearly\_launches |
| --- | --- | --- |
| count | 61.000000 | 61.000000 |
| mean | 2009.360656 | 1.852459 |
| std | 10.125928 | 1.930769 |
| min | 1985.000000 | 1.000000 |
| 25% | 2000.000000 | 1.000000 |
| 50% | 2013.000000 | 1.000000 |
| 75% | 2017.000000 | 2.000000 |
| max | 2022.000000 | 13.000000 |

```python
#saving each dataframe to a csv

African.to_csv('African_SpaceObject.csv')
SouthAmerican.to_csv('SouthAmerican_SpaceObject.csv')
NorthAmerican.to_csv('NorthAmerican_SpaceObject.csv')
Asian.to_csv('Asian_SpaceObject.csv')
European.to_csv('European_SpaceObject.csv')
World.to_csv('World_SpaceObject.csv')
Oceanic.to_csv('Oceanic_SpaceObject.csv')
Agencies.to_csv('Agencies_SpaceObject.csv')
```
