Table of Contents

Part 1

Entries

Entry 1: September 7, 2012

This is the second week of school and our classes are finally starting to become in depth with the course. Of course i mean that like we are starting to dive into the meat of the courses and that makes me happy. In data comm we have started to work with a OS called Asterisk, which will allow us to make phone calls within a local area network. We are just kind of messing around with it to see what we can do and hopefully create our E alert system that we want to create. In data structures we have begun working with datatypes to make sure we are well known with our datatypes. We have to understand the difference and size of each type like int or char to fully understand what kind of data will be going in through our program. In hpc i will be creating a drum machine, so for starters i am just researching ways to create music through linux/C programming and hopefully soon start creating noise with this :D.

Entry 2: September 14, 2012

This week we are head way into making our programs and getting our projects together and such. In data comm we are starting to understand the basics of asterisk. We were able to connect some Voip phones to asterisk so we actually have something we can call to test. We have also discovered that we can throw on our own personal audio onto a certain number or phone number. But for now we just need to succesfully connect all our phones together so we can call each other, I will however try to start converting audio that we can use within the phones. In data structures we are starting on singly linked lists. Its a list of nodes that holds pointers that point to data in a list. but with this list we are only able to go forward so we must learn how to manipulate these lists so we can insert, append and delete nodes at any point in the list. In HPC i have actually started working on a program that will be able to record and playback what i have recorded which will be good cause i can make my own drum samples if i must. I will be accessing the dev/dsp sound driver to access the sound capabilities. So i will be working on this program and hopefully it will work.

Entry 3: September 21, 2012

In data structures we started to take a look at doubly linked lists. It is basically the same as a singly linked list but you have the ability to go forward and backwards. So it will be easier to navigate through a list since you can go back now, however new implementation needs to be learned. But until we really get into them, we are just working on singly linked list projects so we can totally understand for future projects. In Data comm i have been able to put a lot of audio onto the phone. I know exactly how to convert mp3 to gsm so it could be played over a phone line. Then we were able to get asterisk to speak to freeswitch now we just need freeswitch to speak to google voice so we can call anyone we want. So its still a work in progress. And in hpc i havent really touched anything in this class this, i have been focused on getting these projects done so i can work on my own independent project.

Entry 4: September 28, 2012

This week in data structures we still continues on with singly linked lists and just working on them. I have deletion completed but i still have to do insertion. I thought insertion was the same as append, which technically it is, but come to find out insertion is where you place a new node behind and not after like append. So i am little late on that program but i shall have it finished very soon. But other then that, we did more on learning doubly linked and we messed with a deugger little bit on friday. Its a really nifty tool but i think i prefer just debugging a program on my own. In data comm we are still trying to get freeswitch to talk to google but other then that, not much has been done. I added a little audio and i am going to figure out how to make my own automated audio for some audio fun. And in hpc i once again didnt really do much with it, i did some research but i really need to do a lot more if i plan on making this drum machine.

Keywords

Structure Pointer

Definition

A structure pointer is a pointer that points to a structure! Like any pointer,it points to an address in memory. And a structure has multiple elements in one block. Now you can pass and return these structures through functions to get the data you want but this is excessive data movement so to reduce this you would pass a pointer to the structure to the function. All we would have to do is reference the pointer to the struct then dereference it to receive the data we want.

#include <stdio.h>
#include <string.h>
 
struct tag{                     /* the structure type */
    char lname[20];             /* last name */
    char fname[20];             /* first name */
    int age;                    /* age */
    float rate;                 /* e.g. 12.75 per hour */
};
 
struct tag my_struct;           /* define the structure */
void show_name(struct tag *p);  /* function prototype */
 
int main(void)
{
    struct tag *st_ptr;         /* a pointer to a structure */
    st_ptr = &my_struct;        /* point the pointer to my_struct */
    strcpy(my_struct.lname,"Jensen");
    strcpy(my_struct.fname,"Ted");
    printf("
%s ",my_struct.fname);
    printf("%s
",my_struct.lname);
    my_struct.age = 63;
    show_name(st_ptr);          /* pass the pointer */
    return 0;
}
 
void show_name(struct tag *p)
{
    printf("
%s ", p->fname);  /* p points to a structure */
    printf("%s ", p->lname);
    printf("%d
", p->age);
}

References

data Keyword 1 Phase 2

Null Pointers

Definition

A Null pointer is a pointer that points definitively nowhere. It is a special pointer that is used to symbolize that the pointer is pointing at nothing or that there is nothing there. The null pointer is commonly used in malloc, when it fails it returns a null pointer because nothing happened so therefore you get nothing in return.

References

None on this one :)

Demonstration

There is no real way to demonstrate this, if this was compiled in a program it will just come up as undefined or 0 or NULL.

Definition

The link layer is the lowest level in the TCP/IP model. It is a level that contains methods and protocols that only work on the hosts link. It is used in the connections of LAN and WAN, like a phone service that is local to a group or organization and maybe they will eventually branch out onto a WAN connection. This layer is to help connection 2 or more clients to be able to connect and communicate effectively.

References

List any sites, books, or sources utilized when researching information on this topic. (Remove any filler text).

  • Reference 1
  • Reference 2
  • Reference 3

datacomm Keyword 1 Phase 2

VoIP. Voice overlay Internet Proticol

Definition

a system and internet proticol that allows to transmite and receive human voice form one place to another much like the preadvent the tele phone which is analog but in order to use it via computer and the interwebs u need to digitize the sound wave length, tone and pitch of a human voice then transmit via the VoIP system which im not intirely sure of all that happens.

References

  • Astrisk pbx
  • Astrisk pbx wikipedia
  • netcat
  • netcat wikipedia
  • VoIp Wikipedia

Demonstration

Basically voip is like any other telephone except it is used threw the computer. You can connect to someone over the internet or someone inside your home. There is no code or executions to demonstrate how this works, download a voip softphone and boom! discover its magic by dialing in a number or 2.

ALSA/OSS/FIREWIRE

Definition

ALSA stands for Advanced Linux Sound Architecture. It provides sound and MIDI functionality to linux. It supports all types of different sound interfaces, has a safe design and it supports OSS (Open Sound System). Its free and open source so programmers all around have the ability to tinker with it and have fun (so to speak). FIREWIRE is kind of like an ethernet cable or a USB cable. However it has different goals it wants to achieve such as: fast data transfer, ability to handle multiple devices, easy use, plug and play, low cost and hot pluggable ability. It was first established by apple and later standardized by many. It is used mainly for the transfer of audio and media.

References

hpc1 Keyword 1 Phase 2

SPARC

Definition

SPARC is a scalable Processor Architecture RISC instruction set. This is a micro processor that is widely used in sun micro systems hardware.

References

Demonstration

Experiment 1

Question

Can i access the dev/dsp sound driver to enable use of my program?

Resources

Hypothesis

I feel this will not work because i do realize this is an outdated sound driver that has been replaced by ALSA. But i am curious if it is still able to be used at all, maybe its there i just have to find a way to access it and use it.

Experiment

I have a program written for HPC that will access this sound driver if it exists. After i have shown if the dev/dsp is there or not, i will try to locate it and see if i can still use it or not.

Data

1. Here is the program i have written that is suppose to record and replay the recording:

 1 /*
  2 *parrot.c
  3 *Program to illustrate /dev/dsp device
  4 *Records several seconds of sound, then echoes it back
  5 *runs until Control-c pressed.
  6 */
  7
  8 #include <unistd.h>
  9 #include <fcntl.h>
 10 #include <sys/types.h>
 11 #include <sys/ioctl.h>
 12 #include <stdlib.h>
 13 #include <stdio.h>
 14 #include <linux/soundcard.h>
 15
 16 #define LENGTH 3  /*how many seconds of speech to store */
 17 #define RATE 8000 /*the sampling rate*/
 18 #define SIZE 8 /*sample size: 8 or 16 bits */
 19 #define CHANNELS 1 /* 1 = mono, 2 = stereo */
 20
 21 /*this buffer holds the digitized audio*/
 22 unsigned char buf[LENGTH*RATE*SIZE*CHANNELS/8];
 23
 24 int main()
 25 {
 26     int fd;
 27     int arg;
 28     int status;
 29
 30     /*open sound device*/
 31     fd = open("/dev/dsp", O_RDWR);
 32
 33     if(fd < 0)
 34         {
 35             perror("open of /dev/dsp failed");
 36             exit(1);
 37         }
 38
 39     /*set sampling parameters */
 40     arg = SIZE;      /*sample size*/
 41
 42     status = ioctl(fd, SOUND_PCM_WRITE_BITS, &arg);
 43
 44     if (status == -1)
 45         perror("SOUND_PCM_WRITE_CHANNELS ioctl failed");
 46     if (arg != SIZE)
 47         perror("unable to set sample size");
 48
 49     arg = CHANNELS; /*mono or stereo*/
 50
 51     status = ioctl(fd, SOUND_PCM_WRITE_CHANNELS, &arg);
 52
 53     if (status == -1)
 54         perror("SOUND_PCM_WRITE_CHANNELS ioctl failed");
 55     if (arg != CHANNELS)
 56         perror("Unable to set number of channels");
 57
 58     arg = RATE;  /*sampling rate*/
 59     status = ioctl(fd, SOUND_PCM_WRITE_RATE, &arg);
 60     if(status == -1)
 61         perror("SOUND_PCM_WRITE_WRITE ioctl failed");
 62     while (1)    /*loop until ctr-c*/
 63         {
 64             printf("say something:\n");
 65             status = read(fd, buf, sizeof(buf)); /*record some sound*/
 66             if(status != sizeof(buf))
 67                 perror("read wrong number of bytes");
 68             printf("you said:\n");
 69             status = write(fd, buf, sizeof(buf)); /*play it back*/
 70             if (status != sizeof(buf))
 71                 perror("Wrote wrong number of bytes");
 72         /*wait for playback to complete before recording again*/
 73             status = ioctl(fd, SOUND_PCM_SYNC, 0);
 74         if (status == -1)
 75             perror("SOUND_PCMSYNC ioctl failed");
 76         }
 77 }
 78

2. I have run the program to get this message:

lab46:~/src/hpc$ ./parrot
open of /dev/dsp failed: No such file or directory
lab46:~/src/hpc$

3.Now i go for a search of the dev/dsp:

lab46:~$ cat /proc/asound/pcm
lab46:~$ cd proc
-bash: cd: proc: No such file or directory
lab46:~$ cd ..
lab46:/home$ cd ..
lab46:/$ cd proc
lab46:/proc$ cd asound
lab46:/proc/asound$ cd pcm
-bash: cd: pcm: Not a directory
lab46:/proc/asound$ ls
cards  devices  modules  oss  pcm  seq  timers  version
lab46:/proc/asound$ cat pcm
lab46:/proc/asound$ cat devices
  2:        : timer
lab46:/proc/asound$ cat cards
--- no soundcards ---
lab46:/proc/asound$ cd ..
lab46:/proc$ ls
1      11118  11232  12735  16787  19     2274   24531  28441  28539  28600  3133   38    3978  4827  6485  asound       interrupts  modules        timer_stats
10     11122  11233  12736  16788  19252  2275   24642  28449  28540  28601  3135   3803  3981  5     6918  buddyinfo    iomem       mounts         tty
1001   11123  11235  128    16791  19253  2278   24849  28497  28549  28622  3136   388   3983  500   7     bus          ioports     net            uptime
1014   11142  11272  12923  16889  19256  22800  2562   28502  28550  28629  3140   389   3984  5129  7504  cgroups      irq         pagetypeinfo   version
1023   11143  11336  13     16890  2      22801  2565   28503  28558  28632  31855  3904  4     5130  8     cmdline      kallsyms    partitions     vmallocinfo
1029   11147  11339  14     16900  20     22824  2566   28507  28559  29     31857  3907  4007  594   8015  cpuinfo      kcore       sched_debug    vmstat
1038   11148  11348  14725  17     20034  22827  2570   28508  28582  29150  32     3959  4012  6     8141  crypto       key-users   self           xen
1045   11152  11351  14727  178    20035  22891  25728  28517  28583  29151  32024  3961  461   629   8142  devices      keys        slabinfo       zoneinfo
1079   11153  11356  14728  17863  20038  23     26269  28518  28592  29156  32130  3962  462   6310  861   diskstats    kmsg        softirqs
1088   11188  11364  14836  17864  20590  23492  26294  28522  28594  29572  32150  3968  475   6311  862   dma          kpagecount  stat
1098   11189  11896  15     18     21     23493  26299  28523  28595  29573  33     3970  476   6315  8643  driver       kpageflags  swaps
11     1121   12     15037  18303  2156   23497  26302  28527  28596  29576  34     3971  477   6365  9     execdomains  loadavg     sys
11112  11228  12337  15985  18976  217    24     27     28528  28597  3      35     3973  4821  6366  951   fb           locks       sysrq-trigger
11113  11229  12338  16     18977  218    24497  28     28534  28598  30     369    3974  4823  6444  960   filesystems  meminfo     sysvipc
11117  11231  12341  16406  18980  22     24498  28440  28535  28599  31     375    3977  4824  6445  974   fs           misc        timer_list
lab46:/proc$ cd asound
lab46:/proc/asound$ ls
cards  devices  modules  oss  pcm  seq  timers  version
lab46:/proc/asound$ cd oss
lab46:/proc/asound/oss$ ls
devices  sndstat
lab46:/proc/asound/oss$ cat sndstat
Sound Driver:3.8.1a-980706 (ALSA v1.0.21 emulation code)
Kernel: Linux lab46 2.6.32-5-xen-amd64 #1 SMP Mon Jan 9 22:09:26 UTC 2012 x86_64
Config options: 0

Installed drivers:
Type 10: ALSA emulation

Card config:
--- no soundcards ---

Audio devices: NOT ENABLED IN CONFIG

Synth devices: NOT ENABLED IN CONFIG

Midi devices: NOT ENABLED IN CONFIG

Timers:
31: system timer

Mixers: NOT ENABLED IN CONFIG
lab46:/proc/asound/oss$

Analysis

Based on the data collected:

Conclusions

I now know that i must enable the use of ALSA in my program unless i am able to find a way to enable the use of dev/dsp under ALSA-oss. I believe i can find it and i will continue until i can. If i can not find it, then i will just have to modify and move on.